
<%@ page import="givenchy.Task" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'task.label', default: 'Task')}" />
        <title>任务列表</title>
    </head>
    <body>
        <div class="tasknav ">
           <span class="menuButton"><g:link class="create" action="taskList">所有任务</g:link></span>
        </div>
        <div class="body">
            <h1><g:if test="${taskGroupName}">${taskGroupName} >> </g:if><g:else>所有任务 >> </g:else>任务列表</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <div class="list">
                <table>
                    <thead>
                        <tr>
                            <th>任务名称</th>

                            <th>任务组</th>

                            <th>用户</th>
  
                            <th>权重</th>
                        
                            <th>动作</th>
                         
                            <th>是否可用</th>
                            <th></th>
                        
                        </tr>
                    </thead>
                    <tbody>
                    <g:each in="${taskInstanceList}" status="i" var="taskInstance">
                        <tr style="background:none repeat scroll 0 0 ${taskInstance.available?'#FFF':'#FBB'};">

                            <td>${fieldValue(bean: taskInstance, field: "name")}</td>

                            <td>${taskInstance.taskGroup.name}</td>
                        
                            <td>${taskInstance.person.username}(VIP:${taskInstance.person.vip})</td> 
                       
                            <td>${fieldValue(bean: taskInstance, field: "seek")}</td>
                        
                            <td>
                            <g:each in="${taskInstance.actions.split('\r\n')}">
                                 <p>${it}</p>
                            </g:each>

                            </td> 
                        
                            <td><g:if test="${taskInstance.available}">
                                <font size="" color="green">开启状态</font><g:link action="close" id="${taskInstance.id}" params="[groupid:params.id]" >（关闭）</g:link>
                            </g:if>
                            <g:else>
                               <font size="" color="red">关闭状态</font><g:link  action="open" id="${taskInstance.id}" params="[groupid:params.id]" >（开启）</g:link>
                            </g:else></td>

                            <td>
                               
                                   <g:link action="taskEdit" id="${taskInstance?.id}" params="[groupid:params.id]">编辑</g:link>
                                |
                                <g:link action="taskDelete" id="${taskInstance?.id}" params="[groupid:params.id]" 
                                    onclick="return confirm('确定删除此任务吗?');">删除</g:link>
                            </td>
                        
                        </tr>
                    </g:each>
                    </tbody>
                </table>
            </div>
            <div class="paginateButtons">
                <g:paginate total="${taskInstanceTotal}" />
            </div>

        </div>
    </body>
</html>
